home *** CD-ROM | disk | FTP | other *** search
/ Internet Warrior 1993 July / Internet Warrior No. 1 July 1993 - Austin Code Works.ISO / tcpip / cuttcp / cutcp.zoo / readme.scr < prev    next >
Encoding:
Text File  |  1990-11-12  |  14.5 KB  |  465 lines

  1. README.SCR  6/21/90 - Detailed Instructions for Using Script Files with
  2.     CUTCP/CUTE 2.2D,2.2TN/TC-C
  3.  
  4. Bugs to     cutcp-bugs@omnigate.clarkson.edu
  5.  
  6.  
  7. What are script files?
  8.  
  9.     Script files, or command files, instruct CUTE to connect to
  10.     hosts, wait for data, write to the screen, message console
  11.     or remote host, press keys and so on.
  12.  
  13.     Script files are very simple, limited in parsing and have
  14.     special restrictions.
  15.  
  16.     sample.scr and sample2.scr are good examples of script files.
  17.  
  18. How do I activate a Script file?
  19.  
  20.     There are several ways of starting a script file.
  21.  
  22.     1. Using ALT-A, ALT-Z or ALT-V and specifying a destination
  23.        host of
  24.     
  25.             @scriptfile_name
  26.  
  27.       where scriptfile_name is the name of the script command file.
  28.  
  29.       Script command files have an extension of .scr, and CUTE will
  30.       add the .scr for you if you do not include one.
  31.  
  32.     2. Specifying  @scriptfile_name on the command line when starting
  33.        CUTE:
  34.             tn3270 @vmhost
  35.  
  36.     3. Open a standard telnet/rshell/rlogin session and attaching
  37.        a script file using the ALT-MINUS key.
  38.  
  39.     4. Use the @ symbol for host name in your config.tel file.
  40.  
  41.         name=special
  42.         host="@C:\myscripts\special.scr"
  43.  
  44.       Note. this only attaches the script file to the name, it will
  45.       NOT activate the script file after connecting to some specified
  46.       IP address. Rather, your script file should contain an initial
  47.       telnet/rlogin/rshell command.
  48.  
  49. How are Script File Names Resolved?
  50.  
  51.     When you specify a script file name, an attempt is made to
  52.     open a file by that name. If the open fails, the filename
  53.     and extension (sans drive and any paths specified) are stripped
  54.     off and attached to the 'Script Directory Name', in an attempt
  55.     to look in the Script Directory for a script of the specified
  56.     name. This is useful for having a single directory with all your
  57.     script files in it.
  58.  
  59. How do you specify the Script Directory Name? (optional)
  60.  
  61.     In your config.tel file, create a host as follows:
  62.  
  63.         name=script_dir
  64.         host="C:\scripts\"
  65.  
  66.     Set the host= parameter to the location of your script directory.
  67.     YOU MUST INCLUDE THE TRAILING BACKSLASH.
  68.  
  69. How do Script Files Operate?
  70.  
  71.     Script files are processed a line at a time by a simple token
  72.     processor that accepts one or more arguements. Processing halts
  73.     if the incorrect number of arguements are specified.
  74.     For example, the 'write' command accepts a single arguement,
  75.     which is the string to write. If the string contains white
  76.     space characters, than it must be enclosed in quotation marks.
  77.  
  78.     The input processor expands backslash (\) escapes within
  79.     quoted strings only.  The standard set of escapes are supported.
  80.  
  81.         \r    - Return (dec 13)
  82.         \n    - Line Feed (dec 10)
  83.         \e    - escape (dec 27)
  84.         \nnn    - Octal three digit number
  85.         \\    - the \ character
  86.         \;     - the semicolon.
  87.  
  88.     The semicolon is used as a comment delimiter. Any text after a
  89.     semicolon is ignored, unless it is within a quoted string, or
  90.     proceeded by a backslash.
  91.  
  92.     When a script file is opened, it is scanned completely to check
  93.     for errors. Only the commands used and the number of arguements
  94.     are verified during the first pass. 
  95.  
  96.     If the file does not have any basic syntax errors, operation
  97.     begins at the first line of the script file. During operation,
  98.     the script file is kept open until the script is completed.
  99.  
  100.     Telnet/Rlogin/Rshell sessions that have attached script files will
  101.     have a flashing status line entry at the bottom of the screen.
  102.  
  103.     An active session may have a script attached to it by pressing the
  104.     ALT-MINUS key (described above).  An active session with 
  105.     an active script file can have the script cancelled by pressing
  106.     the ALT-MINUS key.
  107.  
  108.     Script commands are case insensitive.
  109.  
  110. What is the basic command structure?
  111.     
  112.     The script file structure is quite simple. Commands are read
  113.     one per line. The command is executed, and if it fails, telnet
  114.     will wait until a timeout occurs,  retrying when new data arrives.
  115.  
  116.     If a command times out without suceeding, an error operation occurs.
  117.     There are three basic error responses:
  118.  
  119.         1. Ignore
  120.         2. Abort
  121.         3. Jump to a label.
  122.  
  123.     The default error operation is Abort, the default timeout is 30 seconds.
  124.  
  125.     After a jump, the error response is set to Abort to avoid loops. It
  126.     may be reset again as required.
  127.  
  128.  
  129. What are the Script commands?
  130.  
  131.     The basic script commands are listed below, in the following format:
  132.  
  133.         command_name Number_of_args NeedCon,Data - Description of command
  134.                 Examples
  135.  
  136.             Expanded Description and side effects.
  137.  
  138.         The command_name is not case sensitive. The number of
  139.         args is the number of arguements expected by the command.
  140.         Some arguements accept strings, which must be enclosed
  141.         in quotes if the string contains whitespace or backslash
  142.         macros.  
  143.  
  144.         The word 'NeedCon' indicates that an active
  145.         connection is required for the command to be executed.
  146.  
  147.         The word 'Data' indicates that this command will be retried
  148.         as soon as some data arrives from the remote host, or when
  149.         a connection is established.
  150.  
  151.  
  152.         Sorry these aren't sorted..
  153. ---------------------------------------------------------------------------
  154.     timeout 1 - Specify the error timeout value
  155.  
  156.             timeout 10
  157.             timeout 0
  158.             timeout 9999
  159.  
  160.         sets the error timeout in seconds. 
  161.  
  162.     keymap 2 NeedCon - Loads the named keymap file for the current session
  163.                or for the default session.
  164.                args (Default, this)
  165.  
  166.         keymap Default "default.tbl"; changes table for all sessions
  167.         keymap this "current.tbl";    changes table for this session only    
  168.  
  169.     setsname 1 NeedCon - Sets the current session name to the arg
  170.  
  171.         setsname "session1"    
  172.  
  173.         simply alters the name displayed on the status line
  174.  
  175.     write 1  NeedCon - Writes the supplied string to the active connection
  176.              - as if typed.
  177.  
  178.         write "Hi mommy\n"
  179.         write "This has a ^D in it \004 and some more stuff;"
  180.  
  181.         The write command sends the supplied string to the remote host
  182.         as if each character were individually typed at the keyboard.
  183.  
  184.         An active connection is required or the script will be aborted.
  185.  
  186.     lookfor 1 NeedCon, Data - Looks for the specified string 
  187.                 - anywhere on the screen.
  188.  
  189.             lookfor "Userid"
  190.             lookfor "Login:"
  191.  
  192.         The lookfor command searches for the supplied string anywhere
  193.         on the current screen. The search is normally  case
  194.         sensitive UNLESS the 'flags nocase' command has been
  195.         executed previously.
  196.  
  197.         A connection is required for this command. New data
  198.         will retry the command until sucess or timeout.
  199.  
  200.     lookat 3 NeedCon, Data - Looks at the indicated location for the 
  201.                    - supplied string.
  202.  
  203.         lookat row column string
  204.  
  205.             lookat 20 2 "Username"
  206.  
  207.             lookat 0 1  "%"
  208.  
  209.         The lookat command is similar to the lookfor command, except
  210.         that the match is made at the specified row and column.
  211.  
  212.         A row value of zero means 'the last line on the screen'.
  213.         (Useful if the user may have 43 line screens, etc).
  214.  
  215.         This command may or may not be case sensitive, depending on
  216.         the use of the 'flags nocase' command.
  217.  
  218.         New data will retry this command and a connection is required.
  219.  
  220.         This command is most useful with 3278 screens.
  221.  
  222.     moveto 2  NeedCon - Moves the cursor to the indicated row and column
  223.               - active 3278 sessions only
  224.  
  225.         moveto row column
  226.  
  227.             moveto 20 1
  228.  
  229.     flags 1        - Sets Script operation variables
  230.  
  231.         flags takes the following possible arguements.
  232.  
  233.             debug  - enables debugging of the script to the
  234.                  console window.
  235.             nodebug - disables debugging data
  236.  
  237.             nocase - turns off case sensitivity for lookat and 
  238.                  lookfor commands.
  239.  
  240.             case     - turns case sensitivity back on.
  241.  
  242.     waitfor 1  NeedCon, Data - Waits for special signal or data
  243.  
  244.         waitfor takes the following possible arguements.
  245.  
  246.             data     - waits for data to arrive
  247.             connection - waits for the connection to open
  248.                     ( not functional on PC-NFS version).
  249.  
  250.     label  1        - Specifies a jump to label
  251.     
  252.             label  mylabel
  253.  
  254.         Use the label command to indicate the target of an
  255.         onerror jump. You may use any string as a label, except
  256.         for the reserved words 'ignore' and 'abort'.
  257.  
  258.     echo  1    NeedCon  - Writes the supplied string to the screen
  259.  
  260.             echo "\e[2J" ; clear the screen
  261.             echo "\e[34m" ; change foreground color
  262.             echo "hi there silly person"
  263.  
  264.         Sends the supplied string to the screen as if sent from
  265.         the host. The screen is always a VT102 emulator
  266.         (even in 3278 mode ... surprise!) so you can use VT102
  267.         escape sequences, graphics chars, etc. You can also
  268.         turn on and off print through mode.
  269.  
  270.     message 1    - Writes the supplied string to the console
  271.  
  272.             message "\e[2J"  ; clear console screen
  273.     
  274.         Sends the supplied string to the console. The console
  275.         is also a VT102 emulator. 
  276.  
  277.     presskey 1    NeedCon - Sends the keycode as if pressed.
  278.             
  279.             presskey 148 ; up arrow
  280.  
  281.             presskey d   ; <CR>
  282.  
  283.         Presskey accepts a single hexadecimal arguement which
  284.         represents the keycode generated by the users keyboard.
  285.  
  286.         Do not include a leading 0x in front of the hex code.
  287.  
  288.         You can determine the proper keycode to use by running
  289.         the testkey.exe program
  290.  
  291.         You can NOT use codes for keyboard commands, such as
  292.         ALT-W, ALT-X, etc. These codes are normally processed at
  293.         e higher level in the program.
  294.  
  295.     onerror 1    - Sets the error handler response typee.
  296.  
  297.         onerror accepts the following arguements:
  298.  
  299.             ignore - Ignore all subsequent errors
  300.             abort  - immediately close the script on failure
  301.                  ( default operation ).
  302.             any_label - Any string that matches a label statement
  303.                   will cause a jump to that location on
  304.                   a timeout error.
  305.  
  306.         After a timeout jump, a 'onerror abort' is automatically
  307.         implied. You may re-arm the onerror handler to a different
  308.         value after the jump if you so desire.
  309.  
  310.     telnet 1    - Telnet to the named host
  311.     rlogin 1    - Rlogin to the named host
  312.     rshell 1    - Rshell to the named host
  313.  
  314.             telnet omnigate
  315.             telnet "clutx.clarkson.edu 25"
  316.             rshell "barnacle -l bkc /bin/cat /etc/password"
  317.  
  318.         These commands accept a single arguement that matches
  319.         what you might type after an ALT-A, ALT-Z or ALT-V
  320.         command. Be sure to put multiple arguement lines in
  321.         quotes. If you already have an active connection, this
  322.         command is silently ignored and the script continues.
  323.  
  324.  
  325.         You may wish to use
  326.  
  327.             waitfor connection
  328.         after the telnet/rlogin/rshell command to ensure that
  329.         the connection is open before proceeding. 
  330.         (waitfor connection doesn't work on the PC-NFS version).
  331.  
  332.         You may also spawn another script using the @ symbol.
  333.         Be sure to 'onerror ignore' since the telnet/rlogin/rshell
  334.         function returns an error on the spawning of a script
  335.         (regardless of whether or not the script is spawned).
  336.  
  337.         Example:
  338.             onerror ignore
  339.             telnet "@script2"
  340.             telnet "@C:\\myscripts\\script.fil"
  341.             onerror abort
  342.             telnet "real.destination"
  343.             waitfor connection
  344.  
  345.         
  346.     delay 1     - Delays the specified number of seconds
  347.             
  348.             delay 5
  349.  
  350.     end        - Indicates the end of the script file
  351.  
  352.         A script file is automatically ended by the end of file or
  353.         ^Z. You may indicate a premature end by using the 'end'
  354.         command. This is useful to terminate one branch of an error
  355.         handler.
  356.  
  357.         Example:
  358.              onerror jump1
  359.             telnet "omnigate"
  360.             waitfor connection
  361.             end
  362.             label jump1
  363.             write "unable to connect to omnigate"
  364.             close
  365.  
  366.     mark        - Not Implemented
  367.  
  368.     close        - Closes the current network connection, if there is
  369.               one.
  370.  
  371.     detach     NeedCon - Detaches the current script from the current connection
  372.  
  373.         You can use the detach command to spawn several
  374.         telnet sessions using one script file.
  375.  
  376.             telnet "host1"
  377.             detach
  378.             telnet "host2"
  379.             detach
  380.             rlogin "host3"
  381.  
  382.     attach 1    - Attaches to the specified connection
  383.         attach "sessionname"
  384.  
  385.         This command attaches the current script to the specified
  386.         session. You must NOT have a current active session
  387.         otherwise this command will fail.
  388.  
  389.     ask    1      - Prompts the user to enter a string in the console
  390.               window. 
  391.  
  392.         This command takes one argument, the string to prompt the
  393.         user with. (A null string "", is ok).
  394.  
  395.         This command will switch to the console window, print the
  396.         arguement, and read up to 79 characters from the console.
  397.  
  398.         The ask command will then switch back to the current session.
  399.  
  400.         If the user presses ESCAPE at any time during the ask
  401.         command, the onerror function will be called as if the
  402.         command had failed. Otherwise the command suceeds.
  403.  
  404.     show    1    - Switches the screen to the console, the current session
  405.               or a named session.
  406.  
  407.         This command takes the following arguements.
  408.  
  409.             console  - Shows the console window
  410.             current  - Shows the window associated with the script.
  411.             any_session_name - attempts to display the session
  412.                  that matches the given name.
  413.  
  414.         If there is no current connection, or no session with the
  415.         given name, the command fails and the onerror function
  416.         will be called.
  417.  
  418.         Example:
  419.             show console
  420.             telnet "host1"
  421.             detach
  422.             telnet "host2"
  423.             show "host1"    ; show the first system
  424.  
  425.     send    1 NeedCon - Sends special codes and data to the remote host.
  426.         
  427.         This command takes the following arguements.
  428.  
  429.             myip  - sends the PC's ip address in dotted decimal form.
  430.             password - sends the internal FTP password (ALT-W)
  431.             ask  - Sends the result of the last ASK command
  432.                    (fails if no ask command has been executed)
  433.  
  434.         This command sends just the data, and no <CR> or <NL>,
  435.         you may use the 'write' command after this command to
  436.         supply the missing CR.
  437.  
  438.  
  439.  
  440. Special Notes:
  441.     
  442.     There is an important distinction between commands that need connections,
  443.     and the waitfor connection command.
  444.  
  445.     If you telnet to a host that requires a domain name lookup, a
  446.     VT102 window will be created, but the Telnet connection will not be
  447.     open for several seconds. In this case, waitfor connection fails 
  448.     until the actual telnet connection is open. But commands that 
  449.     'NeedCon' will proceed because the VT102 window is open.
  450.  
  451.     In summary, the NeedCon check is only made against the existance
  452.     of the VT102 window, an not against the status of the underlying
  453.     TCP connection. This means that a script that does not have the
  454.     'waitfor connection' command, could proceed several steps before
  455.     the connection might timeout, or the domain name lookup fails.
  456.     In this case, the window will the go away (with the usual
  457.     'Connection closed, press a key' prompt). The next command that
  458.     is NeedCon will then fail.
  459.  
  460.  
  461.     Telnet/Rlogin/Rshell to names that require a domain name lookup
  462.     will temporily fail, then (hopefully) restart when the domain name
  463.     is resolved. It seems to work so far.
  464.  
  465.